using UnityEngine;
using System.Collections;

public class Pickup : MonoBehaviour 
{

	// Use this for initialization
	void Start () 
	{
	
	}
	
	// Update is called once per frame
	void Update () 
	{
	
	}
	
	void OnTriggerEnter(Collider cObject)
	{		
		if(cObject.tag == "Player1" || cObject.tag == "Player2")
		{
			PlayerData.levelScore += PlayerData.pickupScore * PlayerData.scoreMultiplier;
			
			GameObject.FindGameObjectWithTag("PickupAudio").GetComponent<AudioSource>().Play();
			
			Debug.Log ("Score is: "+PlayerData.levelScore);
			
			Destroy(gameObject);
		}
	}
}
